package com.glsc.ngateway.opmanage.controller.feign;


import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.glsc.ngateway.common.api.common.enums.PlatformConstant;
import com.glsc.ngateway.common.api.common.utils.PageUtil;
import com.glsc.ngateway.common.api.flowable.dto.CopyProcessDto;
import com.glsc.ngateway.common.api.flowable.dto.ForwardFlowableParamDto;
import com.glsc.ngateway.common.api.flowable.dto.TaskDefinitionDto;
import com.glsc.ngateway.common.api.flowable.dto.demand.FlowableEhrEmpDto;
import com.glsc.ngateway.common.api.flowable.dto.param.*;
import com.glsc.ngateway.common.api.flowable.resp.*;
import com.glsc.ngateway.common.api.platform.resp.PlatformResponse;
import com.glsc.ngateway.common.base.domain.mysql.flowable.FlowableCopy;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.Role;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.User;
import com.glsc.ngateway.opmanage.exception.PlatformException;
import com.glsc.ngateway.opmanage.service.FlowCommonService;
import com.glsc.ngateway.opmanage.service.MailService;
import com.glsc.ngateway.opmanage.service.RoleService;
import com.glsc.ngateway.opmanage.service.UserService;
import com.glsc.ngateway.opmanage.utils.RequestTool;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.stream.Collectors;

import static com.glsc.ngateway.common.api.common.enums.DictConstant.ROLE_OPEARATOR;

/**
 * @author zzp
 * @date 2022/12/9
 * 自研流程调用接口
 */
@RequestMapping("/flowable")
@Api(value = "自研流程调用接口", tags = {"自研流程调用接口"})
@RestController
public class FlowableFeignController {

    private static Logger logger = LoggerFactory.getLogger(FlowableFeignController.class);

    @Resource
    private FlowCommonService flowCommonService;

    @Resource
    private RoleService roleService;

    @Resource
    private RequestTool requestTool;

    @Resource
    private UserService userService;

    @Resource
    private MailService mailService;

    @ApiOperation(value = "流程待办列表分页查询", notes = "流程待办列表分页查询")
    @GetMapping("/findProcessToDoPage")
    public PlatformResponse<Page<ResponseSituationDto>> findProcessToDoPage(
            @ApiParam(value = "流程标题") @RequestParam(required = false) String title,
            @ApiParam(value = "流程类型，多个逗号分割字符串") @RequestParam(required = false) String processDefineKey,
            @ApiParam(value = "流程创建人账号") @RequestParam(required = false) String startUser,
            @ApiParam(value = "流程是否结束") @RequestParam(required = false) String hasProcessEnd,
            @ApiParam(value = "流程创建开始日期") @RequestParam(required = false) String beginDate,
            @ApiParam(value = "流程创建结束日期") @RequestParam(required = false) String endDate,
            @ApiParam(value = "页码从1开始") @RequestParam(required = false) Integer pageNo,
            @ApiParam(value = "每页显示条数 默认10") @RequestParam(required = false) Integer pageSize) {
        logger.info("流程待办列表分页查询");

        ParamSearchDto paramSearchDto = new ParamSearchDto();
        paramSearchDto.setTitle(title);
        paramSearchDto.setProcessDefineKey(processDefineKey);
        paramSearchDto.setStartUser(startUser);
        paramSearchDto.setBeginDate(beginDate);
        paramSearchDto.setEndDate(endDate);
//        paramSearchDto.setHasProcessEnd(hasProcessEnd);

        Page<ResponseSituationDto> page = flowCommonService.findProcessToDoPage(requestTool.getAccountFromRequest(), paramSearchDto, pageNo, pageSize);
        return PlatformResponse.successData(page);

    }


    @ApiOperation(value = "流程已办列表分页查询", notes = "流程已办列表分页查询")
    @GetMapping("/findProcessDonePage")
    public PlatformResponse<Page<ResponseSituationDto>> findProcessDonePage(
            @ApiParam(value = "流程标题") @RequestParam(required = false) String title,
            @ApiParam(value = "流程模板ID") @RequestParam(required = false) String processDefineKey,
            @ApiParam(value = "流程是否结束") @RequestParam(required = false) String hasProcessEnd,
            @ApiParam(value = "流程创建人账号") @RequestParam(required = false) String startUser,
            @ApiParam(value = "流程创建开始日期") @RequestParam(required = false) String beginDate,
            @ApiParam(value = "流程创建结束日期") @RequestParam(required = false) String endDate,
            @ApiParam(value = "页码从1开始") @RequestParam(required = false) Integer pageNo,
            @ApiParam(value = "每页显示条数 默认10") @RequestParam(required = false) Integer pageSize) {
        logger.info("流程已办列表分页查询");

        ParamSearchDto paramSearchDto = new ParamSearchDto();
        paramSearchDto.setTitle(title);
        paramSearchDto.setProcessDefineKey(processDefineKey);
        paramSearchDto.setStartUser(startUser);
        paramSearchDto.setBeginDate(beginDate);
        paramSearchDto.setEndDate(endDate);
//        paramSearchDto.setHasProcessEnd(hasProcessEnd);
        Page<ResponseSituationDto> page = flowCommonService.findProcessDonePage(requestTool.getAccountFromRequest(), paramSearchDto, pageNo, pageSize);
        return PlatformResponse.successData(page);
    }

    @ApiOperation(value = "流程发起列表分页查询", notes = "流程发起列表分页查询")
    @GetMapping("/findProcessStartPage")
    public PlatformResponse<Page<ResponseSituationDto>> findProcessStartPage(
            @ApiParam(value = "流程标题") @RequestParam(required = false) String title,
            @ApiParam(value = "流程模板ID") @RequestParam(required = false) String processDefineKey,
            @ApiParam(value = "流程是否结束") @RequestParam(required = false) String hasProcessEnd,
            @ApiParam(value = "流程创建人账号") @RequestParam(required = false) String startUser,
            @ApiParam(value = "流程创建开始日期") @RequestParam(required = false) String beginDate,
            @ApiParam(value = "流程创建结束日期") @RequestParam(required = false) String endDate,
            @ApiParam(value = "页码从1开始") @RequestParam(required = false) Integer pageNo,
            @ApiParam(value = "每页显示条数 默认10") @RequestParam(required = false) Integer pageSize) {
        logger.info("流程发起列表分页查询");

        ParamSearchDto paramSearchDto = new ParamSearchDto();
        paramSearchDto.setTitle(title);
        paramSearchDto.setProcessDefineKey(processDefineKey);
        paramSearchDto.setStartUser(startUser);
        paramSearchDto.setBeginDate(beginDate);
        paramSearchDto.setEndDate(endDate);
        paramSearchDto.setHasProcessEnd(hasProcessEnd);

        Page<ResponseSituationDto> page = flowCommonService.findProcessStartPage(requestTool.getAccountFromRequest(), paramSearchDto, pageNo, pageSize);
        return PlatformResponse.successData(page);
    }

    @ApiOperation(value = "流程分页查询-调试", notes = "流程分页查询")
    @GetMapping("/findProcessPage")
    public PlatformResponse<Page<ResponseSituationDto>> getProcessSituationPage(
            @ApiParam(value = "流程标题") @RequestParam(required = false) String title,
            @ApiParam(value = "流程模板ID-processDefineKey") @RequestParam(required = false) String processDefineKey,
            @ApiParam(value = "流程是否结束") @RequestParam(required = false) String hasProcessEnd,
            @ApiParam(value = "流程创建人账号") @RequestParam(required = false) String startUser,
            @ApiParam(value = "流程创建开始日期") @RequestParam(required = false) String beginDate,
            @ApiParam(value = "流程创建结束日期") @RequestParam(required = false) String endDate,
            @ApiParam(value = "页码从1开始") @RequestParam(required = false) Integer pageNo,
            @ApiParam(value = "每页显示条数 默认10") @RequestParam(required = false) Integer pageSize) {
        logger.info("流程已办列表分页查询");


        ParamSearchDto paramSearchDto = new ParamSearchDto();
        paramSearchDto.setTitle(title);
        paramSearchDto.setProcessDefineKey(processDefineKey);
        paramSearchDto.setStartUser(startUser);
        paramSearchDto.setBeginDate(beginDate);
        paramSearchDto.setEndDate(endDate);
        paramSearchDto.setHasProcessEnd(hasProcessEnd);

        Page<ResponseSituationDto> page = flowCommonService.getProcessSituationDtoPage(pageNo, pageSize, paramSearchDto);
        //流程鉴权
        return PlatformResponse.successData(page);
    }

    @ApiOperation(value = "相关流程分页查询", notes = "相关流程分页查询")
    @GetMapping("/findInvolveProcessPage")
    public PlatformResponse<Page<ResponseSituationDto>> getInvolveProcessSituationPage(
            @ApiParam(value = "流程标题") @RequestParam(required = false) String title,
            @ApiParam(value = "流程模板ID-processDefineKey") @RequestParam(required = false) String processDefineKey,
            @ApiParam(value = "流程是否结束") @RequestParam(required = false) String hasProcessEnd,
            @ApiParam(value = "流程创建人账号") @RequestParam(required = false) String startUser,
            @ApiParam(value = "流程创建开始日期") @RequestParam(required = false) String beginDate,
            @ApiParam(value = "流程创建结束日期") @RequestParam(required = false) String endDate,
            @ApiParam(value = "页码从1开始") @RequestParam(required = false) Integer pageNo,
            @ApiParam(value = "每页显示条数 默认10") @RequestParam(required = false) Integer pageSize) {
        logger.info("流程已办列表分页查询");

        ParamSearchDto paramSearchDto = new ParamSearchDto();
        paramSearchDto.setTitle(title);
        paramSearchDto.setProcessDefineKey(processDefineKey);
        paramSearchDto.setStartUser(startUser);
        paramSearchDto.setBeginDate(beginDate);
        paramSearchDto.setEndDate(endDate);
        paramSearchDto.setHasProcessEnd(hasProcessEnd);
        User user = requestTool.getUserFromRequest();
        Set<String> roleNames = user.getRoles().stream().map(Role::getName).collect(Collectors.toSet());
        //管理员可以看所有人的流程
        if(roleService.getByName(requestTool.getAccountFromRequest()).stream().noneMatch(r->"admin".equals(r.getName()))
            || !roleNames.contains(ROLE_OPEARATOR)){
            paramSearchDto.setInvolveUser(requestTool.getAccountFromRequest());
        }
        Page<ResponseSituationDto> page = flowCommonService.getProcessSituationDtoPage(pageNo, pageSize, paramSearchDto);
        //流程鉴权
        return PlatformResponse.successData(page);
    }

    @ApiOperation(value = "流程审批通过操作", notes = "流程审批通过操作")
    @PostMapping("/processTaskAuditPass")
    public PlatformResponse<FlowableResponse> processTaskAuditPass(@RequestBody ParamDoTaskDto paramDotaskDto) {
        logger.info("流程审批通过操作,paramDotaskDto=" + paramDotaskDto);
        try {
            FlowableResponse ret = flowCommonService.taskAuditPass(paramDotaskDto);
            return PlatformResponse.successData(ret);
        } catch (Exception e) {
            logger.error("流程审批通过操作查询失败:", e);
            return PlatformResponse.failedMsg("流程审批通过操作失败:" + e.getMessage());
        }
    }

    @ApiOperation(value = "流程审批驳回操作", notes = "流程审批驳回操作")
    @PostMapping("/taskAuditReject")
    public PlatformResponse<FlowableResponse> taskAuditReject(@RequestBody ParamRollbackDto paramRollbackDto) {
        logger.info("流程审批驳回操作,paramRollbackDto=" + paramRollbackDto);
        try {
            FlowableResponse ret = flowCommonService.taskAuditReject(paramRollbackDto);
            return PlatformResponse.successData(ret);
        } catch (Exception e) {
            logger.error("流程审批通过操作查询失败:", e);
            return PlatformResponse.failedMsg("流程审批通过操作失败:" + e.getMessage());
        }
    }

    @ApiOperation(value = "流程强制结束操作", notes = "流程强制结束操作")
    @PostMapping("/processStop")
    public PlatformResponse<FlowableResponse> processStop(@RequestBody ParamStopDto paramStopDto) {
        logger.info("流程强制结束操作,paramStopDto=" + paramStopDto);
        try {
            FlowableResponse ret = flowCommonService.processStop(paramStopDto);

            return PlatformResponse.successData(ret);
        } catch (Exception e) {
            logger.error("流程审批通过操作查询失败:", e);
            return PlatformResponse.failedMsg("流程审批通过操作失败:" + e.getMessage());
        }
    }

    @ApiOperation(value = "分页查询查询流程签字意见", notes = "查询流程签字意见")
    @GetMapping("/findPageFlowComment")
    public PlatformResponse<Page<ResponseCommentDto>> findPageFlowComment(@ApiParam(value = "流程ID") @RequestParam(required = true) String processId,
                                                                          @ApiParam(value = "页码从1开始") @RequestParam(required = false) Integer pageNo,
                                                                          @ApiParam(value = "每页显示条数 默认10") @RequestParam(required = false) Integer pageSize) {
        logger.info("查询流程签字意见=" + processId);
        try {
            ParamCommentDto paramCommentDto = new ParamCommentDto();
            paramCommentDto.setProcessId(processId);
            Page<ResponseCommentDto> commentPage = flowCommonService.queryCommentsByProcessId(PageUtil.initPageNo(pageNo), PageUtil.initPageSize(pageSize), paramCommentDto);

            return PlatformResponse.successData(commentPage);
        } catch (Exception e) {
            logger.error("分页查询查询流程签字意见失败:", e);
            return PlatformResponse.failedMsg("分页查询查询流程签字意见失败");
        }
    }

    /**
     * 生成流程图 正在用
     *
     * @param processId 任务ID
     */
    @GetMapping("/processDiagram")
    @ResponseBody
    @ApiOperation(value = "生成flowable工作流的流程图", notes = "生成流程图")
    public Object genProcessDiagram(HttpServletRequest request
            , HttpServletResponse response
            , String processId) throws Exception {
        if (StrUtil.isEmpty(processId)) {
            throw PlatformException.error("查看流程图需要提供流程ID");
        }
        flowCommonService.genProcessDiagram(request, response, processId);

        return null;
    }

    @ApiOperation(value = "我的抄送", notes = "我的抄送分页查询")
    @GetMapping("/findProcessCopyPage")
    public PlatformResponse<Page<FlowableCopy>> findProcessCopyPage(
            @ApiParam(value = "流程标题") @RequestParam(required = false) String title,
            @ApiParam(value = "状态") @RequestParam(required = false) String status,
            @ApiParam(value = "流程类型（多个逗号分割的字符串）") @RequestParam(required = false) String processDefineKey,
            @ApiParam(value = "页码从1开始") @RequestParam(required = false) Integer pageNo,
            @ApiParam(value = "每页显示条数 默认10") @RequestParam(required = false) Integer pageSize) {
        logger.info("我的抄送分页查询");

        String account = requestTool.getAccountFromRequest();
        Page<FlowableCopy> page = flowCommonService.findProcessCopyPage(account, status, processDefineKey, pageNo, pageSize);
        return PlatformResponse.successData(page);
    }

    @ApiOperation(value = "转办任务", notes = "转办任务")
    @PostMapping("/turnTask")
    public PlatformResponse<ResponseTurnDto> turnTask(@RequestBody TurnTaskDto turnTaskDto) {
        ResponseTurnDto responseTurnDto = flowCommonService.turnTask(turnTaskDto);
        User opUser = requestTool.getUserFromRequest();
        if (opUser == null) {
            throw PlatformException.error("未查询到操作人信息");
        }

        //流程转办，增加邮件通知
        List<String> toUserMailList = userService.getUserEmailListByAccountList(Arrays.asList(turnTaskDto.getTaskToAccount()));
        if (CollectionUtil.isNotEmpty(toUserMailList)) {//转办任务，同时增加邮件通知
            FlowableResponse<ResponseSituationDto> taskInfo = flowCommonService.getTaskInfo(turnTaskDto.getTaskId(), PlatformConstant.SYS_ID_GATEWAY);
            if (taskInfo == null || taskInfo.getStatus() != FlowableResponse.CODE_SUCCESS) {
                throw PlatformException.error(String.format("查询任务%s失败：%s", turnTaskDto.getTaskId(), taskInfo.getMsg()));
            }

//            FlowableProcessInfo flowableProcessInfo = flowableProcessInfoService.findById(taskInfo.getData().getProcessId());
            String mailTitle = String.format("流程转办提醒：%s", taskInfo.getData().getProcessTitle());
            String mailContent = String.format("流程转办提醒，请登录网关系统，流程待办页面，查看待办流程并进行处理。<br/>" +
                            "转办发起人：%s<br/>转办流程：%s<br/>转办任务：%s<br/>转办备注：%s"
                    , opUser.getName(), taskInfo.getData().getProcessTitle(), taskInfo.getData().getCurrentTaskName()
                    , turnTaskDto.getTurnTaskComment());
            mailService.sendMail(toUserMailList, null, mailTitle, mailContent, null);
        }

        return PlatformResponse.successData(responseTurnDto);
    }

    @ApiOperation(value = "抄送流程", notes = "抄送流程，增加待阅事项")
    @PostMapping("/copyProcess")
    public PlatformResponse<FlowableResponse<ResponseMsgDto>> copyProcess(@RequestBody CopyProcessDto copyProcessDto) {
        if (ObjectUtil.isNull(copyProcessDto) || StrUtil.isEmpty(copyProcessDto.getProcessId())
                || CollectionUtil.isEmpty(copyProcessDto.getTaskToAccountList())) {
            throw PlatformException.error("抄送流程时，流程ID、抄送接收人等必要信息不能为空");
        }
        if (StrUtil.isEmpty(copyProcessDto.getCopyProcessComment())) {
            copyProcessDto.setCopyProcessComment("增加抄送，请查阅");
        }

        User opUser = requestTool.getUserFromRequest();
        if (opUser == null) {
            throw PlatformException.error("未查询到抄送操作人信息");
        }

        String copyComment = String.format("%s，抄送发起人：%s", copyProcessDto.getCopyProcessComment(), opUser.getName());

        logger.info("增加流程-%s，抄送，%s", copyProcessDto.getProcessId(), copyComment);

        FlowableResponse<ResponseMsgDto> response = flowCommonService.copyProcess(copyProcessDto.getProcessId(), copyProcessDto.getTaskId()
                , copyProcessDto.getTaskToAccountList(), opUser.getUsername(), copyComment);

        //手工增加的流程抄送，增加邮件通知

        if (response.getStatus() == 0) {
            return PlatformResponse.successData(response);
        } else {
            return PlatformResponse.failedMsg(response.getMsg());
        }
    }

    @ApiOperation(value = "流程强制删除操作 接口ParamDeleteDto.processId多个逗号删除", notes = "删除-流程强制删除操作")
    @PostMapping("/processDelete")
    public PlatformResponse<ResponseMsgDto> processDelete(@RequestBody ParamDeleteDto paramDeleteDto) {
        if (paramDeleteDto == null || StrUtil.isEmpty(paramDeleteDto.getProcessId())) {
            throw PlatformException.error("删除流程时，流程ID不能为空");
        }

        logger.info("删除流程：{}", paramDeleteDto);

        List<String> deleteProcessIdList = Arrays.stream(paramDeleteDto.getProcessId().split(",")).collect(Collectors.toList());
        paramDeleteDto.setProcessIdList(deleteProcessIdList);
        ResponseMsgDto ret = flowCommonService.deleteProcess(paramDeleteDto);
        return PlatformResponse.successData(ret);
    }

    @ApiOperation(value = "查询流程变量", notes = "查询流程变量")
    @GetMapping("/getVariableByProcessId")
    public PlatformResponse<TreeMap<String, Object>> getVariableByProcessId(@ApiParam(value = "流程ID") @RequestParam(required = true) String processId) {
        TreeMap<String, Object> ret = flowCommonService.getVariableByProcessId(processId);
        return PlatformResponse.successData(ret);
    }

    @ApiOperation(value = "设置流程变量（注意xxGroup类操作用户参数需要字符串数组）", notes = "设置流程变量（注意xxGroup类操作用户参数需要字符串数组）")
    @PostMapping("/setupVariableByProcessId")
    public PlatformResponse<String> getVariableByProcessId(@RequestBody ParamSetupVariableSimpleDto variableDto) {
        String ret = flowCommonService.setupVariableByProcessId(variableDto);
        return PlatformResponse.successData(ret);
    }

    @ApiOperation(value = "更新流程标题", notes = "更新流程标题")
    @PostMapping("/updateProcessTitle")
    public PlatformResponse<ResponseMsgDto> updateProcessTitle(@RequestBody ParamUpdateTitleDto paramUpdateTitleDto) {

        FlowableResponse<ResponseMsgDto> ret = flowCommonService.updateProcessTitle(paramUpdateTitleDto);
        return PlatformResponse.successData(ret.getData());
    }

    @ApiOperation(value = "查询流程信息", notes = "查询流程信息")
    @GetMapping("/getProcessInfo")
    public PlatformResponse<ResponseSituationDto> getProcessInfo(@ApiParam(value = "流程ID") @RequestParam(required = true) String processId) {

        ResponseSituationDto ret = flowCommonService.getProcessInfo(processId);
        return PlatformResponse.successData(ret);
    }


    @ApiOperation(value = "转发任务", notes = "转发任务")
    @PostMapping("/taskForward")
    public PlatformResponse<ForwardFlowableResponse> taskForward(@RequestBody ForwardFlowableParamDto forwardParam) {
        logger.info("转发任务,={}", forwardParam);
        try {
            User opUser = requestTool.getUserFromRequest();
            if (opUser == null) {
                throw PlatformException.error("未查询到操作人信息");
            }

            ForwardFlowableResponse forwardFlowableResponse = flowCommonService.forwardFlowableByTask(forwardParam);

            //增加邮件通知 TODO

            return PlatformResponse.successData(forwardFlowableResponse);
        } catch (Exception e) {
            logger.error("转发失败:", e);
            return PlatformResponse.failedMsg("转发失败:" + e.getMessage());
        }
    }

    @ApiOperation(value = "查询某个用户与流程的抄送关系记录", notes = "查询某个用户与流程的抄送关系记录")
    @PostMapping("/getCopyProcessOfUser")
    public PlatformResponse<ResponseCopyUserDto> getCopyProcessOfUser(@RequestBody ParamCopyUserDto paramCopyUserDto) {
        logger.info("查询某个用户与流程的抄送关系记录,={}", paramCopyUserDto);
        try {
            ResponseCopyUserDto responseCopyUserDto = flowCommonService.getCopyProcessOfUser(paramCopyUserDto);
            return PlatformResponse.successData(responseCopyUserDto);
        } catch (Exception e) {
            logger.error("查询失败:", e);
            return PlatformResponse.failedMsg("查询失败:" + e.getMessage());
        }
    }

    @ApiOperation(value = "查询某个用户信息", notes = "查询某个用户信息")
    @GetMapping("/getUserInfoByAccount")
    public PlatformResponse<FlowableEhrEmpDto> getUserInfoByAccount(@ApiParam(value = "oa账号") @RequestParam(required = true) String userId) {
        logger.info("查询某个用户信息,={}", userId);
        FlowableEhrEmpDto responseDto = flowCommonService.getUserInfoByAccount(userId);
        return PlatformResponse.successData(responseDto);
    }

    @ApiOperation(value = "获取所有可回退节点", notes = "获取所有可回退节点")
    @GetMapping("/getAllSourceList")
    public PlatformResponse<List<TaskDefinitionDto>> getAllSourceList(@RequestParam(required = true) String taskId) {
        List<TaskDefinitionDto> sourceList = flowCommonService.getAllSourceList(taskId);
        return PlatformResponse.successData(sourceList);
    }

    @ApiOperation(value = "回退到指定节点", notes = "回退到指定节点")
    @PostMapping("/backToSelect")
    public PlatformResponse<ResponseMsgDto> backToSelect(@RequestBody ParamRollbackDto param) {
        //TODO: flowable端无法去掉校验，在此添加
        param.setContent("none");
        param.setComment(Objects.nonNull(param.getCommentDto()) ? param.getCommentDto().getFullMessage() : "");
        FlowableResponse<ResponseMsgDto> response = flowCommonService.backToSelect(param);
        return response.getStatus() == 0 ? PlatformResponse.successData(response.getData()) : PlatformResponse.failedMsg(response.getMsg());
    }
}

